<!DOCTYPE html>
<html>
	<head>
	<meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title></title>
    <link href="css/mui.min.css" rel="stylesheet"/>
    <link rel="stylesheet" type="text/css" href="css/swiper-3.4.2.min.css"/>
    <link href="style/fjol_style.css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="style/xol_style.css"/>
    <!--<link href="iconfont/iconfont.css" rel="stylesheet" />-->
    <script src="js/mui.min.js"></script>
    <script type="text/javascript" charset="utf-8">
      	mui.init();
    	
    </script>
    <style>
    	*,.mui-table-view.mui-grid-view .mui-table-view-cell{
    		font-size: 14px;
    	}
    	.swiper-container {
		    width: 100%;
		    height: 200px;
		}
		.swiper-slide{
			overflow: hidden;
		}
		#mapTap{
			background: white;
			border: none;
		}
		#mapTap li{
			border: none;
			color: #666;
		}
		#mapTap li.active{
			color: #E94643;
			border-bottom: 2px solid #E94643;
		}
    </style>
	</head>
	<body>
		<header class="mui-bar mui-bar-nav newbgRed">
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		    <h2 class="mui-title"></h2>
		</header>
		<div class="mui-scroll-wrapper" style="bottom: 88px; top: 45px;">
		    <div class="mui-scroll">
		        <!--这里放置真实显示的DOM内容-->
		        <div class="mui-content">
		        	<!--swiper轮播-->
					<div class="swiper-container">
					    <div class="swiper-wrapper" id="swiperWrap">
					    	
					    </div>
					    <!-- 如果需要分页器 -->
					    <div class="swiper-pagination"></div>
					</div>
		            
		            <div align="right" class="p10 pt5 pb5 mui-hidden" id="moreHouseVedio">
		            	<span class="colorGreen f10">房源短视频，看房更直观</span>
		            	<button type="button" class="mui-btn green05b160 keyword-btn" id="photoVideo">
		            		<!--<span class="mui-icon mui-icon-videocam"></span>-->
		            		&nbsp;&nbsp;播放&nbsp;&nbsp;
		            	</button>
		            </div>
		            <div class="bg-white p10 pt10 titleStar">
		            	<span class="f12" id="houseTitle"> </span>
		            </div>
		            <div class="bg-white p10 pt10">
			            <!--<p class="f10 m0"><span id="leaseType"></span><span id="houseType">3室1厅</span></p>-->
			            <div class="flex">
			            	<div class="flexCell">
			            		<p class="f10 flexCell" ><em id="updateDate"></em> 刷新</p>
				            </div>			
	            			<div class="">
	            				<span class="mui-icon headerStar" id="collectionIcon">
							    	<i class="iconfont icon-star1"></i><em class="vm newYellow">收藏</em>
							    </span>
		            			<span class="mui-icon" id="shareHouse">
							    	<img src="imageNew/icon_share@2x.png" height="20"/><em class="newRed vm">分享</em>
							    </span>
	            			</div>
			            </div>
			            
            		</div>
			            		
		            <div class="bg-white p10 pt10 pb10">
		            	
		            <!--<div class="newRed f12" id="totalPrice" style="font-weight: bold;">108万</div>-->
		            <ul class="mui-table-view mui-grid-view mui-grid-9" style="background: none; border: none;">
			            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4" style="border-right: none;">
		                    <p>售价</p>
		                    <div class="newRed f12" id="totalPrice" style="font-weight: bold;">108万</div>
			            </li>
			            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4" style="border-right: none;">
		                    <p>房型</p>
		                    <div class="newRed f12" id="houseType" style="font-weight: bold;">3室1厅</div>
			            </li>
			            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4" style="border-right: none;">
		                    <p>建筑面积</p>
		                    <div class="newRed f12" id="square" style="font-weight: bold;">108㎡</div>
			            </li>
		            </ul>
		            
		        <!--
                	描述：房源亮点
                -->
                <div class="bg-white">
                	<!--<h4 class="bd9 p10" style="line-height: 3em;">房源亮点(标签)</h4>-->
                	<div class="pt10 pb10 f14" style="padding-left: 8px; padding-right: 8px;" id="houseFeature">
                		<!--<button type="button" class="mui-btn mui-btn-outlined" style="margin-right:4px; margin-bottom:4px;">jdsoigf</button>-->
                	</div>
                	<!--<span class="newRed f08 p10">郑重提示：请您在签订合同之前，切勿支付任何形式的费用，以免上当受骗</span>-->
                </div>
		            
		            <!--二手房信息-->
		            <ul class="mui-table-view mui-grid-view mui-grid-9 fj-detail-ul" id="secondHandHouse">
		            <li class="mui-table-view-cell mui-media mui-col-xs-6 mui-col-sm-6 mui-text-left p10">
		                单价：<span style="color: #333333;" id="squarePrice">1280元/㎡</span>
		            </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-6 mui-col-sm-6 mui-text-left">
		                挂牌：<span style="color: #333333;" id="createDate">2017.2.28</span>
		            </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-6 mui-col-sm-6 mui-text-left">
		                朝向：<span style="color: #333333;" id="orientationsName">北</span>
		            </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-6 mui-col-sm-6 mui-text-left">
		                楼层：<span style="color: #333333;" id="floorNumber">中层(共30层)</span>
		            </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-6 mui-col-sm-6 mui-text-left">
		                楼型：<span style="color: #333333;" id="buildingTypeName">中层(共30层)</span>
		            </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-6 mui-col-sm-6 mui-text-left">
		                电梯：<span style="color: #333333;" id="houseEquip">有</span>
		            </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-6 mui-col-sm-6 mui-text-left">
		                 装修：<span style="color: #333333;" id="decorationTypeName">精装修</span>
		            </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-6 mui-col-sm-6 mui-text-left">
		                年代：<span style="color: #333333;" id="buildDate">2013年</span>
		            </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-6 mui-col-sm-6 mui-text-left">
		                用途：<span style="color: #333333;" id="houseTypeName">住宅小区</span>
		            </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-6 mui-col-sm-6 mui-text-left">
		                权属：<span style="color: #333333;" id="propertyTypeName"></span>
		            </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-6 mui-col-sm-6 mui-text-left">
		                首付预算：<span style="color: #333333;" id="downPaymentInfo"></span>
		            </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-6 mui-col-sm-6 mui-text-left p10">
		                <span style="color: #333333;"></span>
		            </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-6 mui-col-sm-6 mui-text-left">
		                小区：<span style="color: #333333;" id="buildingName"></span>
		            </li>
		            </ul>
		            <!--租房信息-->
		            <ul class="mui-table-view mui-grid-view mui-grid-9 fj-detail-ul" id="leaseHouse">
		            <li class="mui-table-view-cell mui-media mui-col-xs-6 mui-col-sm-6 mui-text-left">
		                发布：<span style="color: #333333;" id="leaseCreateDate">2017-02-28</span>
		            </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-6 mui-col-sm-6 mui-text-left">
		                入住：<span style="color: #333333;" id="checkIn">2017-02-28</span>
		            </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-6 mui-col-sm-6 mui-text-left">
		                租期：<span style="color: #333333;" id="leaseMonthCount">2017-02-28</span>
		            </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-6 mui-col-sm-6 mui-text-left">
		                现状：<span style="color: #333333;" id="nowStatus"></span>
		            </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-6 mui-col-sm-6 mui-text-left">
		                年代：<span style="color: #333333;" id="leaseBuildDate">2013年</span>
		            </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-6 mui-col-sm-6 mui-text-left">
		                楼层：<span style="color: #333333;" id="leaseFloorNumber">中层(共30层)</span>
		            </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-6 mui-col-sm-6 mui-text-left">
		                电梯：<span style="color: #333333;" id="leaseHouseEquip">有</span>
		            </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-6 mui-col-sm-6 mui-text-left">
		                车位：<span style="color: #333333;" id="parking">有</span>
		            </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-6 mui-col-sm-6 mui-text-left">
		                用水：<span style="color: #333333;" id="waterDegree">有</span>
		            </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-6 mui-col-sm-6 mui-text-left">
		                用电：<span style="color: #333333;" id="electricDegree">有</span>
		            </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-6 mui-col-sm-6 mui-text-left">
		                燃气：<span style="color: #333333;" id="gasDegree">北</span>
		            </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-6 mui-col-sm-6 mui-text-left">
		                采暖：<span style="color: #333333;" id="heatingDegree"></span>
		            </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-6 mui-col-sm-6 mui-text-left">
		                小区：<span style="color: #333333;" id="leaseBuildingName"></span>
		            </li>
		            </ul>
		            <p class="mui-text-center m10 pt5 pb5" style="background: #f5f7f7; color: #6991c5;" id="moreHouseInfo">更多房源信息</p>
		            </div>
		        
                <!--生活场景-->
                <div class="bg-white mt10 p10 pt10 pb10" >
                	
                	<div id="noneMap"></div>
                	<div id="map" style="height: 300px;">
                			<!--地图加载中...-->
                			<img style="width: 100%; height: 100%;" src="https://api.map.baidu.com/staticimage?ak=EsrHmzrDrLvFPSlpPKGGtGTAfWsjVhdl&center=118.602278,24.888239&zoom=16&markers=118.602278,24.888239&markerStyles=l" />
                	</div>
                </div>
                <!--
                	附近地图资源
                -->
                <div class="">
                	<ul class="mui-table-view mui-grid-view mui-grid-9" id="mapTap">
                	<li class="mui-table-view-cell mui-media mui-col-xs-2 mui-col-sm-2 active">
                	    餐饮
                	</li>
                	<li class="mui-table-view-cell mui-media mui-col-xs-2 mui-col-sm-2">
                	    购物
                	</li>
                	<li class="mui-table-view-cell mui-media mui-col-xs-2 mui-col-sm-2">
                	    学校
                	</li>
                	<li class="mui-table-view-cell mui-media mui-col-xs-2 mui-col-sm-2">
                	    公交站
                	</li>
                	<li class="mui-table-view-cell mui-media mui-col-xs-2 mui-col-sm-2">
                	    银行
                	</li>
                	<li class="mui-table-view-cell mui-media mui-col-xs-2 mui-col-sm-2">
                	    医疗
                	</li>
                	</ul>
                	<ul id="r-result" class="mui-table-view">
            	        <!--<li class="mui-table-view-cell flex">
            	            <span class="flexCell">荣誉酒店</span>
            	            <em>约461米</em>
            	        </li>-->
            	    </ul>
                </div>
                <!--
                	描述：房源概况
                -->
                <div class="bg-white mt10">
                	<h4 class="bd9 p10" style="line-height: 3em;">房源概述</h4>
                	<div class="p10 pt10 pb10" id="houseDescription">
                		
                	</div>
				</div>
                	<!--<div class="p10 mt10"><button type="button" class="mui-btn mui-btn-success mui-btn-block" style="padding: 0;">展开更多</button></div>-->	
                
                <!--附近房源-->
                <div class="bg-white mt10" id="nearbyHouse">
                	<div class="mui-clearfix" style="line-height: 3em;">
                		<span class="p10 mui-pull-left" style="line-height: 3em;">相关推荐</span>
                		
                	</div>
                	<ul class="mui-table-view" id="nearHouseList">
                	    
                	</ul>
                </div>
               
		        </div>
		    </div>
		    
		</div>
		<div class="mui-bar mui-bar-tab house-detail-footer" style="box-shadow: none;">
				<div class="mui-pull-left" style="max-width: 25%; margin-right: 1%;">
					<img src="images/icon_default_header@2x.png" id="agentImg" height="80" style="max-width: 100%;"/>
				</div>
				<div class="mui-pull-left" style="width: 74%;">
					<div class="agent" id="agentBox">
						
					</div>
					<div class="" id="searchHouseListFooter">
					    <a class="mui-tab-item" id="fjMortgage">
					        <span class="mui-icon house-icon house-loan-icon"></span>
					        <span style="color: #fdb181;">房贷计算</span>
					    </a>
					    <a class="mui-tab-item" id="cutPrice">
					        <span class="mui-icon house-icon house-cutprice-icon"></span>
					        <span style="color: #6ca4e6;">短信</span>
					    </a>
					    <a class="mui-tab-item"id="appointment">
					        <span class="mui-icon house-icon house-appoint-icon"></span>
					        <span class="newRed">预约看房</span>
					    </a>
					    
					</div>
					<div class="dn" id="houseListFooter">
					    <a class="mui-tab-item" id="cutPrice">
					        <span class="mui-icon house-icon house-cutprice-icon"></span>
					        <span style="color: #6ca4e6;">短信</span>
					    </a>
					    <a class="mui-tab-item" id="appointment2">
					        <span class="mui-icon house-icon house-appoint-icon"></span>
					        <span class="newRed">预约看房</span>
					    </a>
					</div>
					
				</div>
		</div>
		
	</body>
	<script src="js/jquery-2.1.0.js"></script>
	<script src="js/jquery.tmpl.min.js"></script>
	<script src="js/swiper-3.4.2.jquery.min.js"></script>
	<script src="js/fj_public_js.js"></script>
	<script src="js/md5.js"></script>
	<script src="js/common.util.js"></script>
	<script src="js/network.js"></script>
	<script src="js/mui.picker.js"></script>
	<script src="js/xzx.open.js"></script>
	
	<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=EsrHmzrDrLvFPSlpPKGGtGTAfWsjVhdls"></script>
	
	<script id="swiperTmpl" type="text/x-jquery-tmpl">
		{{if $item.hasImg()}}
		<div class="swiper-slide"><img src="${fullUrl}"/></div>
		{{else}}
		<div class="swiper-slide"><img src="images/icon_blank.png"/></div>
		{{/if}}
	</script>
	<script id="agentBoxTmpl" type="text/x-jquery-tmpl">
		{{if realname}}
		${realname} 
		{{else}}
		经纪人
		{{/if}}
		<span>
			{{each $item.agentStarFull()}}
	    	<i data-index='0' class="mui-icon mui-icon-star-filled f08"></i>
	    	{{/each}}
	    	{{if $item.agentStarHalf()}}
			<i data-index='1' class="mui-icon mui-icon-starhalf f08"></i>
			{{/if}}
			{{each $item.agentStar()}}
			<i data-index='2' class="mui-icon mui-icon-star f08"></i>
			{{/each}}
		</span>
	</script>
	
	<script id="houseListTmpl" type="text/x-jquery-tmpl">
		<li class="mui-table-view-cell" id="${id}">
	        <a href="javascript:;" class="" style="padding-right:20px;">
	        	<div class="mui-pull-left mr5" style="width: 90px; height: 65px; overflow: hidden;">
	        		{{if coverImage}}
	        		<img src="${coverImage}">
	        		{{else}}
	        		<img src="images/icon_blank.png" style="max-width: 100%; max-height: 75px;">
	        		{{/if}}
	        	</div>
				<div class="mui-media-body" style="white-space: normal; line-height: inherit;">
					<span style="font-weight: bold;">${title}</span>
					
						<div class="flex" style="color:#ef263a;">
							<p class="flexCell f08 m0">${bedRoomNumber}室 ${livingRoomNumber}厅 ${square}平</p>
							<div class="">
								<span style="font-weight: bold;font-size: 13px;">${squarePrice}</span>
								<span class="f08">元/平</span> 
							</div>
						</div>
						<p class="mui-ellipsis f08 m0">${area} ${houseTypeName}</p>
						<div class="f08">
							{{if keyword}} {{each(i,word) $item.getKeyword()}}
							<button class="mui-btn ${word.className} keyword-btn f08">${word.value}</button> {{/each}} {{/if}}
						</div>
						
				</div>
	        </a>
	    </li>
	</script>
	
	<script>
				  
		mui.plusReady(function(){
			
			var wv = plus.webview.currentWebview();
			var houseId = wv.houseId;
			var userInfo = common.myStorage.getItem('userInfo');
			var kind = 2;
			 var houseTitle;
			if(wv.kind){
				kind = wv.kind;
			}
//			console.log(userInfo.clientId);
			var param;
			if(userInfo){
				param = [{
						key: 'houseId',
						value: houseId
					},{
						key: 'clientId',
						value: userInfo.clientId
					}];
			}else{
				param = [{
						key: 'houseId',
						value: houseId
					}];
			}
			
		
		//收藏图标
		var collectionIcon = document.querySelector('#collectionIcon');
		var collectionIcon_i;
		
			
			//是否是租房信息
			if(kind==3||wv.parentid=='fj_house_list'){
//				console.log('这是租房的详细');
				$('#houseListFooter').show();
				$('#searchHouseListFooter').hide();	//房贷计算器
//				$('.headerStar').hide();
				$('#moreHouseVedio').hide();
				$('#moreHouseInfo').text('更多小区信息').hide();
				$('#nearbyHouse').hide();
				$('#secondHandHouse').hide();	//隐藏二手房信息字段
				$('#leaseHouse').show();		//显示租房信息字段
			}else{
				$('#houseListFooter').hide();
				$('#searchHouseListFooter').show();		//房贷计算器
//				$('.headerStar').show();
				$('#moreHouseVedio').show();
				$('#moreHouseInfo').text('更多房源信息');
				$('#nearbyHouse').show();
				$('#secondHandHouse').show();	//显示二手房信息字段
				$('#leaseHouse').hide();		//隐藏租房信息字段
				
			}
			
				collectionIcon_i = collectionIcon;
		
		fjNetwork.get('fjzx/common/house-detail.json',param,function(data){ //获取房源详情
				var houseInfo = data.house;
				houseTitle = houseInfo.title;	//房源标题
				var saleman = data.saleman;	//业务员信息
				var mobile = saleman.mobile;	//业务员联系号码
				
			console.log(JSON.stringify(data));
			collectionIcon_i.addEventListener('tap',function(){	//点击收藏按钮
			var loginTrue = isLogined();	//是否登录
			var collectionIcon_iChild = this.getElementsByTagName('i')[0];
			if(loginTrue){
				
			var this_class = collectionIcon_iChild.classList;
			var collectionValue;
			if(this_class.length==3){	//取消收藏
				collectionIcon_iChild.setAttribute('class','iconfont icon-star1');
				collectionIcon_iChild.nextSibling.innerHTML = '收藏';
				collectionIcon_iChild.nextSibling.setAttribute('class','vm newYellow');
				var paramCollection = [{
					key:'collectionId',
					value:data.collectionId
				}];
				fjNetwork.post('fjzx/client/cancel-house-collection.json',paramCollection,function(data){
//					console.log(data.msg);
					mui.toast(data.msg);
				},function(message){
					mui.toast(message);
				})
			}else{						//点击收藏
				var collectParam = [{
					key: 'houseId',
						value: houseId
					},{
						key: 'clientId',
						value: userInfo.clientId
				}];
				collectionIcon_iChild.setAttribute('class','iconfont icon-star newYellow');
				collectionIcon_iChild.nextSibling.innerHTML = '已收藏';
				collectionIcon_iChild.nextSibling.setAttribute('class','vm newYellow');
				fjNetwork.post('fjzx/client/add-house-collection.json',collectParam,function(data){
//					console.log(data.msg);
					mui.toast(data.msg);
				},function(message){
					mui.toast(message);
				})
			}
			
			}else{
//				console.log(loginTrue);
			}
		});
		
				//成功
//				console.log(JSON.stringify(data.house));
				document.querySelector('#agentImg').src = saleman.headImgUrl?saleman.headImgUrl:'images/icon_default_header@2x.png';
				
				$('#agentBoxTmpl').tmpl(saleman,{
					agentStarFull: function(){
						var commentScore = this.data.commentScore?this.data.commentScore:0;
						var commentTotal = this.data.commentTotal?this.data.commentTotal:0;
						var score = commentTotal==0?0 : parseInt(commentScore/commentTotal);
						var starStr = [];
						starStr.length = parseInt(score);
						return starStr;
					},
					agentStarHalf: function(){
						var commentScore = this.data.commentScore?this.data.commentScore:0;
						var commentTotal = this.data.commentTotal?this.data.commentTotal:0;
						var score = commentTotal==0?0 : parseInt(commentScore/commentTotal);
						var halfScore = parseInt(score);
						if(halfScore>score){
							return true;
						}else{
							return false;
						}
					},
					agentStar: function(){
						var commentScore = this.data.commentScore?this.data.commentScore:0;
						var commentTotal = this.data.commentTotal?this.data.commentTotal:0;
						var score = commentTotal==0?0 : parseInt(commentScore/commentTotal);
						var rest = parseInt(5-score);
						var starStr = [];
						starStr.length = parseInt(rest);
						return starStr;
					}
				}).appendTo('#agentBox');
				
				//高亮收藏图标
				if(data.collectionId){		//已收藏
					collectionIcon_i.getElementsByTagName('i')[0].setAttribute('class','iconfont icon-star newYellow');
					collectionIcon_i.getElementsByTagName('i')[0].nextSibling.innerHTML = '已收藏';
					collectionIcon_i.getElementsByTagName('i')[0].nextSibling.setAttribute('class','vm newYellow');
				}else{						//未收藏
					collectionIcon_i.getElementsByTagName('i')[0].setAttribute('class','iconfont icon-star1');
					collectionIcon_i.getElementsByTagName('i')[0].nextSibling.innerHTML = '收藏';
					collectionIcon_i.getElementsByTagName('i')[0].nextSibling.setAttribute('class','vm');
				}
				
				//房屋轮播图
				var swiperHeight = $(window).width()/16*9;
				$('.swiper-container').css('height',swiperHeight);
				var photoList = data.photoList;
//				console.log(JSON.stringify(photoList));
				$('#swiperTmpl').tmpl(photoList,{
					hasImg:function(){
						if(photoList.length>0){
							return true;
						}else{
							return false;
						}
					}
				}).appendTo('#swiperWrap');
							
				 var mySwiper = new Swiper ('.swiper-container', {
					    direction: 'horizontal',
					    loop: true,
					    autoplay:4000,
					    autoplayDisableOnInteraction : false,	//false：用户操作后自动不会停止
					    // 如果需要分页器
					    pagination: '.swiper-pagination',
					  });
				
				//设置轮播图片宽高比例  16:9
				var imgObj = $('#swiperWrap img');
				var RATE = parseFloat(9/16);	//常量，图片框比例
				imgObj.each(function(){
					$(this).load(function(){	//图片加载成功后执行
						var rate = parseFloat($(this).height()/$(this).width());
//							console.log(rate);
						if(rate<RATE){		//高度不够
							$(this).css('height',swiperHeight);
							$(this).css('width',$(this).height()/rate);
						}else{				//宽度不够
							$(this).css('width',$(window).width());
							$(this).css('height',$(this).width()*rate);
						}
						if($(this).width()>$(window).width()){
							var marginLeft = parseInt(-($(this).width()-$(window).width())*0.5);
							$(this).css('margin-left',marginLeft);
						}
						if($(this).height()>swiperHeight){
							var marginTop = parseInt(-($(this).height()-swiperHeight)*0.5);
							$(this).css('margin-top',marginTop);
						}
					});
				});
				
				//查看房源相册
				document.querySelector('#swiperWrap').addEventListener('tap',function(){
					openWindowWithPage('house_photolist',{
						photoList:photoList
					});
				});
				  
				
				//房源短视频播放
				if(photoList.imageTypeEnumValue==0){		//0:视频类型；999：其他；数字：一般图片
//					console.log(photoList.imageTypeEnumValue);
					document.querySelector('#moreHouseVedio').classList.remove('mui-hidden');
					document.querySelector('#photoVideo').addEventListener('tap',function(){
						var Intent = plus.android.importClass("android.content.Intent");
					    var Uri = plus.android.importClass("android.net.Uri");
					    var main = plus.android.runtimeMainActivity();
					    var intent=new Intent(Intent.ACTION_VIEW);
					    var uri;
					    	uri=Uri.parse(photoList[0].fullUrl);
					    intent.setDataAndType(uri,"video/*");
					    main.startActivity(intent);
					});
			}else{
					document.querySelector('#moreHouseVedio').classList.add('mui-hidden');
				}
				
				
				//房屋标题
				document.querySelector('#houseTitle').innerHTML = houseInfo.title;
				
				document.querySelector('.mui-title').innerHTML = houseInfo.title;
				//售价
				var totalPrice = Math.round(houseInfo.totalPrice/10000);
				if(kind==3||wv.parentid=='fj_house_list'){
					document.querySelector('#totalPrice').innerHTML = houseInfo.leasePriceMonth + '元/月';
				}else{
					document.querySelector('#totalPrice').innerHTML = totalPrice + '万';
				}
				//房型
				var bedRoomNumber = houseInfo.bedRoomNumber;
				var livingRoomNumber = houseInfo.livingRoomNumber;
				document.querySelector('#houseType').innerHTML = bedRoomNumber + '室' + livingRoomNumber + '厅';
				//更新时间
				var updateDate = houseInfo.updateDate;
				var updatetime = new Date(updateDate).toLocaleString();
//				console.log(updatetime);
				document.querySelector('#updateDate').innerHTML = updatetime;
				//面积
				var square = houseInfo.square;
				document.querySelector('#square').innerHTML = square + '㎡';
				
				//单价
				var squarePrice = Math.round(houseInfo.squarePrice);
				document.querySelector('#squarePrice').innerHTML = squarePrice + '元/㎡';
				//装修
				var decorationTypeName = houseInfo.decorationTypeName;
				document.querySelector('#decorationTypeName').innerHTML = decorationTypeName;
				//类型
				var houseTypeName = houseInfo.houseTypeName;
				document.querySelector('#houseTypeName').innerHTML = houseTypeName;
				//朝向
				var orientationsName = houseInfo.orientationsName;
				document.querySelector('#orientationsName').innerHTML = orientationsName;
				// 楼层
				var buildNumber;
				var floorTotal = houseInfo.floorTotal;
//				console.log(houseInfo.floorNumber);
				if (houseInfo.floorNumber<=4) {
			        buildNumber = "低层";
			    }else if (houseInfo.floorNumber<=12){
			        buildNumber = "中层";
			    }else if (houseInfo.floorNumber<=18){
			        buildNumber = "高层";
			    }else{
			        buildNumber = "超高层";
			    }
				document.querySelector('#floorNumber').innerHTML = buildNumber + '(共'+floorTotal+'层)';
				document.querySelector('#leaseFloorNumber').innerHTML = buildNumber + '(共'+floorTotal+'层)';
				
				//楼型
				document.querySelector('#buildingTypeName').innerHTML = houseInfo.buildingTypeName?houseInfo.buildingTypeName:'';
				//电梯
				var houseEquipName = houseInfo.houseEquipName;
				document.querySelector('#houseEquip').innerHTML = houseInfo.hasElevator?'有':'无';
				document.querySelector('#leaseHouseEquip').innerHTML = houseInfo.hasElevator?'有':'无';
				
				//年代
				var buildDate = houseInfo.buildDate;
				var buildtime = new Date(buildDate).toLocaleString();
				var buildtimer = buildtime.split('-')[0];
				document.querySelector('#buildDate').innerHTML = buildtimer + '年';
				document.querySelector('#leaseBuildDate').innerHTML = buildtimer + '年';
				
				//发布时间
				var createDate = houseInfo.createDate;
				var createtime = new Date(createDate).toLocaleString();
				var createtimer = createtime.split(' ')[0];
				document.querySelector('#createDate').innerHTML = createtimer;
				document.querySelector('#leaseCreateDate').innerHTML = createtimer;
				
				//小区
				var buildingName = houseInfo.buildingName;	//区域
				var area;
				if(houseInfo.area){
					area = houseInfo.area+'-';
				}else{
					area = '';
				}
				document.querySelector('#buildingName').innerHTML = buildingName;
				document.querySelector('#leaseBuildingName').innerHTML = buildingName;
				
				//权属
				document.querySelector('#propertyTypeName').innerHTML = houseInfo.propertyTypeName?houseInfo.propertyTypeName:'暂无数据'
				//首付预算
				document.querySelector('#downPaymentInfo').innerHTML = houseInfo.downPaymentInfo?houseInfo.downPaymentInfo:'暂无数据';
				//装修年份
				var decorationDate = houseInfo.decorationDate;
				var decorationtime = new Date(decorationDate).toLocaleString();
				var decorationtimer = decorationtime.split('-')[0];
				
				//入住
				document.querySelector('#checkIn').innerHTML = houseInfo.checkIn?houseInfo.checkIn:'暂无数据';
				//租期
				document.querySelector('#leaseMonthCount').innerHTML = houseInfo.leaseMonthCount?houseInfo.leaseMonthCount:'暂无数据';
				//现状
				document.querySelector('#nowStatus').innerHTML = houseInfo.nowStatus?houseInfo.nowStatus:'暂无数据';
				//车位
				document.querySelector('#parking').innerHTML = houseInfo.parking?houseInfo.parking:'暂无数据';
				//用水
				document.querySelector('#waterDegree').innerHTML = houseInfo.waterDegree?houseInfo.waterDegree.toFixed(2) + '元/单位':'暂无数据';
				//用电
				document.querySelector('#electricDegree').innerHTML = houseInfo.electricDegree?houseInfo.electricDegree.toFixed(2) + '元/单位':'暂无数据';
				//燃气
				document.querySelector('#gasDegree').innerHTML = houseInfo.gasDegree?houseInfo.gasDegree.toFixed(2) + '元/单位':'暂无数据';
				//采暖
				document.querySelector('#heatingDegree').innerHTML = houseInfo.heatingDegree?houseInfo.heatingDegree.toFixed(2) + '元/单位':'暂无数据';
				
				//是否漏水
				var leakageWater;
				if(houseInfo.leakageWater){
					leakageWater = '有';
				}else{
					leakageWater = '无';
				}
				
				//产权备案
				var propertySetFlag;
				if(houseInfo.propertySetFlag){
					propertySetFlag = '已提交';
				}else{
					propertySetFlag = '未提交';
				}
				
				//契税办理时间————所有权办理时间
				var propertyHandleDate = houseInfo.propertyHandleDate;
				var propertyHandleDateTime = new Date(propertyHandleDate).toLocaleString();
				var propertyHandleDatetimer = propertyHandleDateTime.split('-')[0];
				
				//银行抵押解押情况
				var mortgageBank,mortgageBankMoney;
				if(houseInfo.mortgageBank==0){
					mortgageBank = '无';
					mortgageBankMoney = '无';
				}else if(houseInfo.mortgageBank==-1){
					mortgageBank = '可自行解押';
					mortgageBankMoney = '自行解押';
				}else{
					mortgageBank = '需客户解押';
					mortgageBankMoney = houseInfo.mortgageBank;
				}
				
				//开发商
				var developer;
				if(houseInfo.developer==null){
					developer = '未知';
				}else{
					developer = houseInfo.developer;
				} 
				//物业公司
				var propertyCompany;
				if(houseInfo.propertyCompany==null){
					propertyCompany='未知';
				}else{
					propertyCompany = houseInfo.propertyCompany;
				}
				//物业费
				var propertyCosts;
				if(houseInfo.propertyCosts==null) propertyCosts='';
				else{propertyCosts = houseInfo.propertyCosts;}
				//车库率
				var propertyCosts;
				if(houseInfo.propertyCosts==null){propertyCosts='0.0'}
				else{propertyCosts=houseInfo.propertyCosts}
				//小区管理
				var managerTypeName;
				if(houseInfo.managerTypeName==null){managerTypeName='未知'}
				else{managerTypeName=houseInfo.managerTypeName}
				//所属街道
				var street;
				if(houseInfo.street==null){street='未知'}
				else{street = houseInfo.street}
				//所属社区
				var community;
				if(houseInfo.community==null){community = '未知'}
				else{community = houseInfo.community}
				//是否能入户口
				var intoAccount;
				if(houseInfo.intoAccount==null){intoAccount = ''}
				else{ intoAccount = houseInfo.intoAccount}
				//就读小学
				var primarySchool;
				if(houseInfo.primarySchool==null){primarySchool = '未知'}
				else{ primarySchool = houseInfo.primarySchool}
				//就读中学
				var middleSchool;
				if(houseInfo.middleSchool==null){middleSchool = '未知'}
				else{middleSchool = houseInfo.middleSchool}
				//房源缺陷
				var defectDescription;
				if(houseInfo.defectDescription){defectDescription = houseInfo.defectDescription}
				else{defectDescription = ''}

				//楼盘信息
				var buildingParam = [{
					key:'楼盘',
					value:buildingName
				},{
					key:'开发商',
					value:developer
				},{
					key:'物业公司',
					value:propertyCompany
				},{
					key:'物业费',
					value:propertyCosts
				},{
					key:'车库率',
					value:houseInfo.parkRatio?houseInfo.parkRatio:'未知'
				},{
					key:'小区管理',
					value:managerTypeName
				},{
					key:'所属街道',
					value:street
				},{
					key:'所属社区',
					value:community
				},{
					key:'是否能入户口',
					value:intoAccount
				},{
					key:'就读小学',
					value:primarySchool
				},{
					key:'就读中学',
					value:middleSchool
				}];
				//房源信息
				var houseInfoParam = [{
					key:'面积',
					value:square
				},{
					key:'户型格局',
					value:bedRoomNumber+'房'+livingRoomNumber+'厅'+houseInfo.toiletNumber+'卫'+houseInfo.kitchenRoomNumber+'厨'+houseInfo.balconyNumber+'阳台'
				},{
					key:'类型',
					value:houseTypeName
				},{
					key:'建筑年份',
					value:buildtimer
				},{
					key:'装修类型',
					value:decorationTypeName
				},{
					key:'装修年份',
					value:decorationtimer
				},{
					key:'朝向',
					value:orientationsName
				},{
					key:'光照时长',
					value:houseInfo.illuminationHouse
				},{
					key:'是否漏水',
					value:leakageWater
				},{
					key:'楼层',
					value:buildNumber
				},{
					key:'房屋配备',
					value:houseInfo.houseEquipName
				},{
					key:'可出售车位',
					value:houseInfo.parkingNumber
				},{
					key:'车位单价',
					value:houseInfo.parkingPrice
				},{
					key:'产权类型',
					value:houseInfo.propertyTypeName
				},{
					key:'产权备案',
					value:propertySetFlag
				},{
					key:'契税办理时间',
					value:propertyHandleDatetimer
				},{
					key:'银行抵押',
					value:mortgageBank
				},{
					key:'解押金额',
					value:mortgageBankMoney
				},{
					key:'税费',
					value:houseInfo.taxes
				},{
					key:'销售意愿',
					value:houseInfo.salesIntentionName
				},{
					key:'房源缺陷',
					value:defectDescription
				}];
				
				//租房
				if(kind==3||wv.parentid=='fj_house_list'){
					//楼盘信息
					var buildingParam = [{
						key:'楼盘',
						value:buildingName
					},{
						key:'开发商',
						value:developer
					},{
						key:'物业公司',
						value:propertyCompany
					},{
						key:'物业费',
						value:propertyCosts
					},{
						key:'车库率',
						value:houseInfo.parkRatio?houseInfo.parkRatio:'未知'
					},{
						key:'小区管理',
						value:managerTypeName
					},{
						key:'所属街道',
						value:street
					},{
						key:'所属社区',
						value:community
					}];
					//房源信息
					var houseInfoParam = [{
						key:'面积',
						value:square
					},{
						key:'户型格局',
						value:bedRoomNumber+'房'+livingRoomNumber+'厅'+houseInfo.toiletNumber+'卫'+houseInfo.kitchenRoomNumber+'厨'+houseInfo.balconyNumber+'阳台'
					},{
						key:'类型',
						value:houseTypeName
					},{
						key:'建筑年份',
						value:buildtimer
					},{
						key:'装修类型',
						value:decorationTypeName
					},{
						key:'装修年份',
						value:decorationtimer
					},{
						key:'朝向',
						value:orientationsName
					},{
						key:'光照时长',
						value:houseInfo.illuminationHouse
					},{
						key:'是否漏水',
						value:leakageWater
					},{
						key:'楼层',
						value:buildNumber
					},{
						key:'房屋配备',
						value:houseInfo.houseEquipName
					}];
				}
				document.querySelector('#moreHouseInfo').addEventListener('tap',function(){
					openWindowWithPage('moreHouseInfo',{
						buildingParam:buildingParam,
						houseDetailInfo:houseInfoParam,
						houseInfo:houseInfo
					});
				});
				
				//房源亮点
				var keyword = houseInfo.keyword;
				var houseFeature = document.querySelector('#houseFeature');
				var houseFeatureData = new Array();
				var featureColor = [
						'featureColor-yellow',
						'featureColor-green',
						'featureColor-blue',
						'featureColor-blue2'
						];
						
				if(keyword){
					var houseFeatureArr = new Array();
					houseFeatureArr = keyword.split(',');
					for (i in houseFeatureArr) {
						
						houseFeatureData.push('<button type="button" class="mui-btn mui-btn-outlined p5" style="margin-right:6px; margin-bottom:6px;">'+houseFeatureArr[i]+'</button>');
					}
					houseFeature.innerHTML = houseFeatureData.join('');
				}
				
				var houseFeatureBtn = houseFeature.getElementsByTagName('button');
				for (var i = 0; i < houseFeatureBtn.length; i++) {
//					var round = Math.floor(Math.random()*4);
					var round = i%featureColor.length;
					houseFeatureBtn[i].classList.add(featureColor[round]);
				}
				
				//房源概况
				document.querySelector('#houseDescription').innerHTML = houseInfo.description;
				
				//短信
				document.querySelector('#cutPrice').addEventListener('tap',function(e){

						e.detail.gesture.preventDefault(); //修复iOS 8.x平台存在的bug，使用plus.nativeUI.prompt会造成输入法闪一下又没了
						var btnArray = ['取消', '确定'];
						var msg = plus.messaging.createMessage(plus.messaging.TYPE_SMS);
						msg.to = [mobile];
						msg.body = '你好，我对“鑫在线”APP上的 '+buildingName+square+' ㎡ '+bedRoomNumber+'室'+livingRoomNumber+'厅'+houseInfo.toiletNumber+'卫 标价'+totalPrice+'万的这套房源很感兴趣，希望作进一步了解，请及时与我取得联系，谢谢。';
						plus.messaging.sendMessage( msg,function(){
							//success
						},function(){
							//error
						} );

					
				});
				
				//房贷计算
		document.querySelector('#fjMortgage').addEventListener('tap',function(){
			openFileWindowWithPage('buy_house','fj_mortgage',{
				allPayment:totalPrice
			});
			
		});
						
		//预约看房
				document.querySelector('#appointment').addEventListener('tap',function(){
//					var loginTrue = isLogined();	//是否登录
					if(userInfo){

						var appointTime = new Date().toLocaleString().replace(',','');
//						console.log(appointTime);
						var appointParam = [{
								key:'houseId',
								value:houseId
							},{
								key:'clientId',
								value:userInfo.clientId
							},{
								key:'reserveDate',
								value:appointTime
							}]
							fjNetwork.post('fjzx/client/add-house-reserve.json',appointParam,function(data){
								//成功
//								console.log(JSON.stringify(data));
							},function(message){
								//失败 
//								console.log(message);
								mui.toast(message);
							});
					}
					//拨打经纪人电话
					mui.confirm('联系经纪人:'+mobile+'？','预约电话',['直接拨打','稍后联系'],function(e){
						if(e.index == 0){
							plus.device.dial(mobile, false);
						}
						
					});
					
				});
				document.querySelector('#appointment2').addEventListener('tap',function(){
					var loginTrue = isLogined();	//是否登录
					if(loginTrue){

						var appointTime = new Date().toLocaleString();
//						console.log(appointTime);
						var appointParam = [{
								key:'houseId',
								value:houseId
							},{
								key:'clientId',
								value:userInfo.clientId
							},{
								key:'reserveDate',
								value:appointTime
							}]
							fjNetwork.post('fjzx/client/add-house-reserve.json',appointParam,function(data){
								//成功
//								console.log(JSON.stringify(data));
							},function(message){
								//失败 
//								console.log(message);
								mui.toast(message);
							});
							mui.confirm('联系经纪人:'+mobile+'？','预约电话',['直接拨打','稍后联系'],function(e){
								if(e.index == 0){
									plus.device.dial(mobile, false);
								}
								
							})
					}else{
						
					}
				});
				
				//静态地图
				var longitude = houseInfo.longitude;
				var latitude = houseInfo.latitude;
//				console.log(longitude+','+latitude);
//				'http://api.map.baidu.com/staticimage/v2?ak=EsrHmzrDrLvFPSlpPKGGtGTAfWsjVhdl&mcode=666666&center='+longitude+','+latitude+'&width=320&height=300&zoom=11&markers='+longitude+','+latitude;
				document.querySelector('#map img').src='https://api.map.baidu.com/staticimage?ak=EsrHmzrDrLvFPSlpPKGGtGTAfWsjVhdl&center='+longitude+','+latitude+'&zoom=16&markers='+longitude+','+latitude+'&markerStyles=l'
				document.querySelector('#map img').addEventListener('tap',function(){
					openWindowWithPage('fj_house_map',{
						longitude:longitude,
						latitude:latitude,
						buildingName:houseInfo.buildingName
					})

				});
				
				//地图附近资源查找
				var map = new BMap.Map("noneMap");            // 创建Map实例
				var pointA = new BMap.Point(longitude, latitude);	//本地坐标位置
				map.centerAndZoom(pointA, 16);
				var options = {
					onSearchComplete: function(results){
						// 判断状态是否正确
//						console.log(JSON.stringify(results.getPoi(0)));
						if (local.getStatus() == BMAP_STATUS_SUCCESS){
							var s = [];
							for (var i = 0; i < results.getCurrentNumPois(); i ++){
//								console.log(JSON.stringify(results.getPoi(i)));
								var mPoint = results.getPoi(i).point;
								var pointB = new BMap.Point(mPoint.lng,mPoint.lat);//
								var distance = map.getDistance(pointA,pointB).toFixed(0);	//两点间的距离,米
//								console.log(distance);
								s.push('<li class="flex p10 mb5">'+
		            	            '<span class="flexCell">'+results.getPoi(i).title+'</span>'+
		            	            '<em>约'+distance+'米</em>'+
		            	        	'</li>');
							}
							document.getElementById("r-result").innerHTML = s.join("");
						}
					}
				};
				var local = new BMap.LocalSearch(map, options);
				local.searchNearby('餐饮',pointA,1000);
				
				mui('#mapTap').on('tap','li',function(){
					$('#mapTap li').removeClass('active');
					this.classList.add('active');
					var searchKey = this.innerHTML;
					local.searchNearby(searchKey,pointA,1000);
				});
			
			var houseType = document.querySelector('#houseType').innerHTML.replace(/[^0-9]/ig,",");
			var square = document.querySelector('#square').innerHTML.replace(/[^0-9]/ig,"");
//			console.log(square);
			var bedRoomNumber = new Array();
			bedRoomNumber = houseType.split(',');
			//附近房源
			var nearHouse = [{
				key:'filterHouseId',
				value:houseId
			},{
				key:'bedRoomNumber',
				value:bedRoomNumber[0]
			},{
				key:'livingRoomNumber',
				value:bedRoomNumber[1]
			},{
				key:'square',
				value:square
			},{
				key:'page',
				value:1
			},{
				key:'rows',
				value:10
			}];
			
			fjNetwork.get('fjzx/common/more-recommend-house-list.json',nearHouse,function(data){
				//成功
//				console.log(JSON.stringify(data));
				var rows = data.rows;
				$('#houseListTmpl').tmpl(rows,{
						getKeyword:function(){
							var keyword = this.data.keyword;
							
							if(keyword){
								var keywordArr = keyword.split(',');
								var keywordCls = [
									'keyword-color1 ',
									'keyword-color2 ',
									'keyword-color3 ',
									'keyword-color4 '
								];
								var len = keywordArr.length<4?keywordArr.length:4
								var keywordData = new Array();
								for (var i=0; i<len; i++) {
									var pas = i % keywordCls.length;
									keywordData[i] = {
										className:keywordCls[pas],
										value:keywordArr[i]
									};
								}
								return keywordData;
						}else{
								keyword='';
							}
						}
					}).appendTo('#nearHouseList');
					
					var imgObj = $('#nearHouseList img');
					var RATE = 0.75;	//常量，图片框比例
					imgObj.each(function(){
						$(this).load(function(){
							var rate = parseFloat($(this).height()/$(this).width());
							if(rate<RATE){		//高度不够
								$(this).css('height','75px');
								$(this).css('width',$(this).height()/rate);
							}else{				//宽度不够
								$(this).css('width','100px');
								$(this).css('height',$(this).width()*rate);
							}
							if($(this).width()>100){
								var marginLeft = parseInt(-($(this).width()-100)*0.5);
								$(this).css('margin-left',marginLeft);
							}
							if($(this).height()>75){
								var marginTop = parseInt(-($(this).height()-75)*0.5);
								$(this).css('margin-top',marginTop);
							}
						});
					});
	
				
			},function(message){
				//失败
				mui.toast(message);
			});		//获取更多推荐房源END
			
			
			},function(message){
				//失败
//				console.log(message);
				mui.toast(message);
			});		//获取房源信息结束
			
			
			document.querySelector('#shareHouse').addEventListener('tap',function(){
//				console.log(houseTitle);
				var ids = [{
                    id: "weixin", 
                    ex: "WXSceneSession"  /*微信好友*/
                }, {
                    id: "weixin",
                    ex: "WXSceneTimeline" /*微信朋友圈*/
                }
//              , {
//                  id: "qq"   /*QQ好友*/
//              }
                ],
                bts = [{
                    title: "发送给微信好友"
                }, {
                    title: "分享到微信朋友圈"
                }
//              , {
//                  title: "分享到QQ"
//              }
                ];
	            plus.nativeUI.actionSheet({
	                    cancel: "取消",
	                    buttons: bts
	                },
	                function(e) {
	                    var i = e.index;
	                    if (i > 0) {
	                        shareAction(ids[i - 1].id, ids[i - 1].ex,houseId,kind,userInfo,houseTitle);
	                    }
	                }
	            );
			});
			
			
			
			/*更新分享服务*/
			updateSerivces();
			
		});	//plusready()结束
		mui('#nearHouseList').on('tap','li',function(){
			console.log(this.getAttribute('id'));
					mui.openWindow({
						url:'recommend_house_detail.html',
						id:'recommend_house_detail',
						extras:{
							houseId:this.getAttribute('id'),
							parentid:'house_detail'
						}
					})
				});
		Date.prototype.toLocaleString = function() {
			var month = this.getMonth() + 1;
			if(month<10){
				month ='0'+month;
			}
			var day = this.getDate();
			if(day<10){
				day ='0'+day;
			}
	          return this.getFullYear() + "-" + month + "-" + day + " " + this.getHours() + ":" + this.getMinutes() + ":" + this.getSeconds();
	    };
	   
	   //////////////////是否登录////////////
	   function isLogined(){
	   	var userInfo = common.myStorage.getItem('userInfo');
	   	if(!userInfo){		//未登录的情况
	   		mui.confirm('请登录','提示',['立即登录','暂不登录'],function(e){
//	   			console.log(e.index);
	   			if(e.index == 0){		//立即登录
	   				openFileWindowWithPage('personal_pages','login',{
	   					parentId:'house_detail'
	   				});
	   			}
	   		});
	   		return false;
	   	}else{
	   		return true;
	   	}
	   }
	   
	   
			/**
         * 分享操作
         */
        function shareAction(id, ex,houseId,kind,userInfo,houseTitle) {
            var s = null;
            if (!id || !(s = shares[id])) {
                outLine("无效的分享服务！");
                return;
            }
            if (s.authenticated) {
                outSet("---已授权---");
                shareMessage(s, ex,houseId,kind,userInfo,houseTitle);
            } else {
                outSet("---未授权---");
                s.authorize(function() {
                    shareMessage(s, ex,houseId,kind,userInfo,houseTitle);
                }, function(e) {
                    outLine("认证授权失败");
                });
            }
        }
        /**
         * 发送分享消息
         */
        function shareMessage(s, ex, houseId,kind,userInfo,houseTitle) {
        	
            var msg = {
                content: '分享-鑫在线',
                href: 'http://www.xinzhongzheng.com/mobile/share_house_detail?houseId='+houseId+'&kind='+kind,
                title: houseTitle,
                content: '房产 装修 家政 生活',
                thumbs: ['images/logo512x512.png'],
                pictures: ['images/logo512x512.png'],
                extra: {
                    scene: ex
                }
            };
            s.send(msg, function() {
                outLine("分享成功!");
                
                //登录状态下 分享成功增加积分
                if(userInfo){
                	shareSuccess(userInfo);
                }
                
            }, function(e) {
                outLine("分享失败!");
            });
        }
        /**
         * 更新分享服务
         */
        function updateSerivces() {
            plus.share.getServices(function(s) {
                shares = {};
                for (var i in s) {
                    var t = s[i];
                    shares[t.id] = t;
                }
                outSet("获取分享服务列表成功");
            }, function(e) {
                outSet("获取分享服务列表失败：" + e.message);
            });
        }
        // 控制台输出日志
        function outSet(msg) {
            console.log(msg);
        }
        // 界面弹出吐司提示
        function outLine(msg) {
            mui.toast(msg);
        }
        /*分享成功*/
       function shareSuccess(userInfo){
//	       	console.log(userInfo.clientId);
	       	var shareParam = [{
	        	key:'clientId',
	        	value:userInfo.clientId
	        }]
	        fjNetwork.post('fjzx/client/add-app-share-integral.json',shareParam,function(data){
//	        	console.log(JSON.stringify(data));
	        });
       }
		</script>
	


</html>
